package com.zhxh.nzpos.setting;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;

import com.zhxh.nzpos.BaseActivity;
import com.zhxh.nzpos.R;
import com.zhxh.nzpos.api.ConnectorGoods;
import com.zhxh.nzpos.utils.DLog;

/**
 * 初始化界面
 * 
 * @author wangzt
 *
 */
public class InitSettingActivity extends BaseActivity {
	
	ImageView cancelBtn ;
	ConnectorGoods connectorGoods;

	 ProgressBar progressBar;  
	public ImageView getRefreshButton() {
		return cancelBtn;
	}
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting_init);
        connectorGoods= new ConnectorGoods();
       
        initViews();
    }
	
	private void initViews() {
		progressBar = (ProgressBar)findViewById(R.id.progressBar02);
		final EditText passwordET = (EditText) findViewById(R.id.manager_password_et);
		ImageView okBtn = (ImageView) findViewById(R.id.init_ok_btn);
		okBtn.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				// TODO初始化信息
				if( TextUtils.isEmpty(passwordET.getText().toString())){
					passwordET.setError( "密码不能为空" );
					return;
					
				}
				LoadGoodsThread thread = new LoadGoodsThread(v,InitSettingActivity.this,connectorGoods,progressBar);
				thread.execute();
				DLog.i("Load Goods111111111111111111111111", "onPostExecute() <-- i'm here");
				//Toast.makeText(getApplicationContext(), "密码初始化设置成功", Toast.LENGTH_SHORT).show();
				//finish();
			}
		});
/*		cancelBtn = (ImageView) findViewById(R.id.init_cancel_btn);
		cancelBtn.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				finish();
			}
		});*/
	}
}
